import {
  GoodsWinForm,
  Response,
  ResponseIPageWin,
  Responselong,
  TaskWinForm,
  WeiXinJiangLiDuiHuan,
  XuNiKaDuiHuan
} from '@/types/apiType';

import request from '../utils/request';
import { RequestConfig } from '../utils/request/type';

/**
 * @description 我的奖励记录
 * @tags 奖励接口
 * @summary 我的奖励记录
 * @request get:/api/win/myWin
 */
export const apiWinMyWinByGet = (
  params: { activityId?: number; pageNo?: number; pageSize?: number; status?: string },
  config?: RequestConfig
) => request.get<ResponseIPageWin>(`/api/win/myWin`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 奖励接口
 * @summary 领取集卡奖励
 * @request post:/api/win/receiveGoods
 */
export const apiWinReceiveGoodsByPost = (params: GoodsWinForm, config?: RequestConfig) =>
  request.post<Response>(`/api/win/receiveGoods`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 奖励接口
 * @summary 兑换虚拟奖励
 * @request post:/api/win/receiveReward
 */
export const apiWinReceiveRewardByPost = (params: XuNiKaDuiHuan, config?: RequestConfig) =>
  request.post<Response>(`/api/win/receiveReward`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 奖励接口
 * @summary 领取任务奖励
 * @request post:/api/win/receiveTask
 */
export const apiWinReceiveTaskByPost = (params: TaskWinForm, config?: RequestConfig) =>
  request.post<Response>(`/api/win/receiveTask`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 奖励接口
 * @summary 兑换微信奖励
 * @request post:/api/win/receiveWeixinReward
 */
export const apiWinReceiveWeixinRewardByPost = (
  params: WeiXinJiangLiDuiHuan,
  config?: RequestConfig
) =>
  request.post<Response>(`/api/win/receiveWeixinReward`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 奖励接口
 * @summary 未领取奖励数
 * @request get:/api/win/unReceiveCount
 */
export const apiWinUnReceiveCountByGet = (config?: RequestConfig) =>
  request.get<Responselong>(`/api/win/unReceiveCount`, {}, config).then((res) => res?.result);
